package com.cooper.service.admin;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cooper.dao.admin.PageDetailDAO;
import com.cooper.dao.admin.PagePanelDAO;
import com.cooper.entity.PageDetailEntity;
import com.cooper.entity.PagePanelEntity;

@Service
public class PageEditService {
	
	protected Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
	private PagePanelDAO pagePanelDao;
	
	@Autowired
	private PageDetailDAO pageDetailDao;
	
	public PagePanelEntity getPagePanelByKey(String pageKey) throws Exception{
		return this.pagePanelDao.loadByKey(pageKey);
	}
	
	public PageDetailEntity getPageDetailById(long detailId) throws Exception{
		return this.pageDetailDao.loadById(detailId);
	}
	
	public Long savePageDetail(PageDetailEntity entity) throws Exception{
		return this.pageDetailDao.saveEntity(entity);
	}
	
	public void updatePagePanel(PagePanelEntity entity) throws Exception{
		this.pagePanelDao.updateEntity(entity);;
	}
	
	public boolean updatePageDetail(PageDetailEntity entity) throws Exception{
		return this.pageDetailDao.updateEntity(entity);
	}

}
